﻿using System;
using System.Web;
using System.Web.Services;
using System.Web.Script.Services;
using UDS.Entity;

namespace UDS.WebApp.SubModule
{
    /// <summary>
    /// Summary description for PFService
    /// </summary>
    [WebService(Namespace = "http://www.chzhou.com/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ScriptService]
    public class PFService : WebService
    {
        /// <summary>
        /// create a sub directory
        /// </summary>
        [WebMethod]
        public int CreateDirectory(int parentId, string name)
        {
            return PFDirectoryInfo.CreateDirectory(SiteContext.Current.UserID, parentId, name);
        }

        /// <summary>
        /// delete the given directory
        /// </summary>
        [WebMethod]
        public bool DeleteDirectory(int directoryId)
        {
            PFDirectoryInfo.Delete(SiteContext.Current.UserID, directoryId);
            return true;
        }

        /// <summary>
        /// delete the given file
        /// </summary>
        [WebMethod]
        public bool DeleteFile(int fileId)
        {
            PFFileInfo.Delete(SiteContext.Current.UserID, fileId);
            return true;
        }
    }
}
